<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form name="myform" action="" method="">
        <select id="sortId">
            <option value="0">全部</option>
        </select>
        <input type="button" id="qureybtn" value="搜索"/>
    </form>
    <input type="button" id="postbtn" value="发帖"/>
    <table id="detailList">
         <thead>
             <tr>
                 <th>帖子ID</th>
                 <th>标题</th>
                 <th>作者</th>
                 <th>发布时间</th>
                 <th>回复次数</th>
             </tr>
         </thead>
         <tbody></tbody>
    </table>

<script src="js/jquery-1.12.4.js"></script>
<script>
    $(function () {
        $("#sortId").blur(function () {
            $.post("selectSort.do",function (data) {
                for(var i=0;i<data.length;i++){
                    var sort=data[i];
                    var str="<option value='"+sort.sortId+"'>"+sort.sortName+"</option>";
                    $("#sortId").append(str);
                }
            },"json")
        });
    })
    
    $(function () {
        $.get("selectdetail.do",function (data) {
            for(var i=0;i<date.length;i++){
                var detail=data[i];
                var str="<tr>"+"<td>"+detail.id+"</td>"+
                        "<td>"+detail.title+"</td>"+"<td>"+detail.author+"</td>"
                         +"<td>"+detail.createDate+"</td>"+"<td>"+detail.replyCount+"</td>";
                $("#detailList>tbody").append(str);
            }
        },"json");

    })
</script>
</body>
</html>